﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Collections;
using System.Windows;
using System.Windows.Media;

namespace Filas
{
    public class Labels : CommomFunctions.Labels
    {        
        public Labels()
        {

        }

        /// <summary>
        /// Creates the labels of the queue elements.
        /// </summary>
        /// <param name="gd">
        /// The grid to which the labels will be added.
        /// </param>
        /// <param name="numElements">
        /// Maximum number of elements in the queue. Thus, here it represents the number of labels.
        /// </param>
        public void createLabels(Grid gd, int numElements)
        {
            for (int i = 0; i < numElements; i++)
            {
                Label tempLabel = new Label();
                gd.Children.Add(tempLabel);
                labels.Add(tempLabel);
            }

            foreach (Label lbl in labels)
            {
                lbl.Visibility = Visibility.Hidden;
                lbl.Content = (labels.IndexOf(lbl) + 1).ToString();
                lbl.VerticalAlignment = VerticalAlignment.Bottom;
                lbl.HorizontalAlignment = HorizontalAlignment.Center;
                lbl.Foreground = Brushes.Fuchsia;
                lbl.FontWeight = FontWeights.Bold;
                lbl.FontSize = 14;
                Grid.SetRow(lbl, 2);
                Grid.SetColumnSpan(lbl, 6);
            }
        }

        /// <summary>
        /// Sets the labels' margins when the grid size changes
        /// </summary>
        internal void gridSizeChanged(int numElements)
        {
            for (int i = 0; i < numElements; i++)
            {
                ((Label)(labels[i])).Margin = new Thickness((66) * (i + 1), 35, (66) * (10 - i), 5.0);
            }
        }
    }
}
